<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .main {
        width: 300px;
        height: 300px;
        background: skyblue;
        display: grid;
        /* grid-template-columns: 100px 100px 100px; */
        /* grid-template-rows: 100px; */

        /* 默认：row就是行产生隐式网格 */
        /* grid-auto-flow: row; */
        /* 可以调节产生隐式网格的高度 */
        /* grid-auto-rows: 50px; */

        grid-template-columns: 100px;
        grid-template-rows: 100px 100px 100px;
        grid-auto-flow: column;
        grid-auto-columns: 100px;
      }
      .main div {
        background: pink;
        border: 1px solid black;
        box-sizing: border-box;
      }

      .main2 {
        width: 300px;
        height: 300px;
        background: skyblue;
        display: grid;
        grid-template-columns: 100px 100px 100px;
        grid-template-rows: 100px;
        grid-auto-flow: row dense;
        grid-auto-rows: 100px;
      }
      .main2 div {
        background: pink;
        border: 1px solid black;
        box-sizing: border-box;
      }
      .main2 div:nth-of-type(1){
        grid-column-start: 2;
      }
    </style>
  </head>
  <body>
    <div class="main">
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
      <div>5</div>
    </div>
    <hr>
    <div class="main2">
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
      <div>5</div>
    </div>
  </body>
</html>
